package com.oauth.service.impl;

import com.oauth.mapper.OpenResourceAuthMapper;
import com.oauth.mapper.OpenResourceMapper;
import com.oauth.model.OpenResource;
import com.oauth.model.OpenResourceAuth;
import com.oauth.service.OpenResourceAuthService;
import com.oauth.service.OpenResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by yangjianbo on 2016/9/30.
 */
@Service
public class OpenResourceServiceImpl implements OpenResourceService {

    @Autowired
    private OpenResourceMapper openResourceMapper;

    @Override
    public Boolean isEnable(String resourceId) {

        OpenResource openResource=openResourceMapper.selectByPrimaryKey(resourceId);
        if(openResource==null){
            return false;
        }else if(!openResource.getResourceState().equals(0)){
            return false;
        }else {
            return true;
        }
    }
}
